import { LOGIN, LOGOUT } from './actions';

const defaultParam = {
  isAdmin: false,
  menus: [],
  roles: [],
  userInfo: {},
};

function adminReducer(state = defaultParam, action: any) {
  switch (action.type) {
    case LOGIN:
      return { ...action.payload };
    case LOGOUT:
      return defaultParam;
    default:
      return state;
  }
}

export default adminReducer;
